_frontend/widget: Allow showing the CAS digest of built artifacts#1994
_frontend/widget: Allow showing the CAS digest of built artifacts#1994gtristan merged 2 commits intoapache:masterfrom
Conversation
d2b2537 to
541cc9e
Compare
541cc9e to
1125a57
Compare
|
I added a test, it's probably not enough though… |
I tend to agree, while the “CAS” is an implementation detail it’s fairly well known, I think I’d rather avoid exposing the word in APIs if we don’t already have it. Also valid point about source caches. let’s use another name, perhaps Also, was this man page updated using the automated generation ? We should only update the command description in |
|
Isn't "hash" more technical than "digest" too (genuine question, I don't know)? What about just The man page what updated manually, I'll update it in a different commit then. |
|
Regarding testing in this PR: Yes the added test is good to add, but not at all sufficient IMO. What I would like to see here...
I realize this is a lot of text, but it shouldn't be too difficult to do in practice, there are examples of all of this in the tests already. |
2ee7cd4 to
435a56b
Compare
tests/frontend/show.py
Outdated
| @pytest.mark.parametrize( | ||
| "target, expected_digests", | ||
| [ | ||
| ("target.bst", { |
There was a problem hiding this comment.
Note that, as I am asking for a separate project directory be created for this test to stand on its own and not mingle data with other tests... I really think it is sufficient to just have a project with less elements.
I'd be happy enough with one element, but it would be useful to test various different import elements:
- A regular file with some simple example content e.g. "The perverted pink pony mounts the unwilling hippopotamus"
- A regular file with execute permission
- A symbolic link
The value here might be to check that we indeed get differing content hashes for individual files with different modes/types, however... while I didn't think of asking for this, and I'm highly confident that such content hashes are going to differ, it might be interesting to actually know.
There was a problem hiding this comment.
I confirm the hash changes when a file is executable or not. I tested it with a working test, then running chmod +x on an imported file, ran the tests and got a different digest, then chmod -x on the same file and the old digest matched anew.
There was a problem hiding this comment.
Right so lets include some different samples / hard coded digests in the tests if it's not too much trouble.
There was a problem hiding this comment.
Nah it's trivial, I did it already (locally). 🙂
There was a problem hiding this comment.
As mentioned in my new comments, let's take care to:
- Have one test which cares about what the digests are
- This test is parametrized (and uses the
idsespecially since it produces these super long test names) - Not use parametrization for cases where the digest value itself doesn't matter.
This is just about only testing what is relevant to test, and keeping overall test time to a minimum.
| result = cli.run(project=project, silent=True, args=["show", "--format", "%{name},%{artifact-cas-digest}", target]) | ||
| result.assert_success() | ||
|
|
||
| digests = dict(line.split(",", 2) for line in result.output.splitlines()) |
There was a problem hiding this comment.
I feel this is over engineered, you're testing a single element each time.
There was a problem hiding this comment.
It is because I carried it over from my previous test which also tested dependencies. 🙂 I'm considering adding dependencies to a test, just so we can check they were built and we can access their digest. Otherwise indeed it could and should be simplified.
There was a problem hiding this comment.
I feel ambivalent about this test, however I don't know that it is relevant, it seems irrelevant
- We are not testing the user's ability to parse
bst showoutput here - Are we testing that a cas digest of an element with dependencies has a specific digest ?
- If so, we can add that single element in the same test with the rest of the other elements which have potentially different cas digests
- Note that the dependencies of an artifact does not affect its digest, because what we are interested in is the digest of the content of the artifact, not the digest of the overall artifact envelope.
Perhaps, it is relevant to test that artifacts which have the same content but differing dependencies have exactly the same cas digest ? if only as a means of validating that we are reporting the correct digest here ?
|
Overall, thanks for updating the tests, its a great update and sorry I didn't get back to it sooner. There are some more comments which should be straight forward to address, and one comment which I find concerning, regarding whether we are actually reporting the correct digest of the content and not the digest of the artifact envelope: #1994 (comment)
|
f1124db to
d2a6b91
Compare
|
Interestingly, this is the first time Asides from the testing we've already added in this PR around what happens with remote caches and locally deleted artifacts, this also raises the question of how this behaves with remote execution and options such as It seems however fine that the digests will be empty unless a |
06512b9 to
5d5ffc2
Compare
|
I believe I addressed all your comments, please let me know if I missed something. |
a981379 to
eecc2a8
Compare
This adds the artifact-cas-digest format string to the show command, allowing to show the CAS digest of the built artifact.
|
Thanks for your relentless work on this ! |
This adds the
artifact-cas-digestformat string to the show command.This is a first step implementing #1984.